<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head class="fly-header layui-bg-black" th:include="admin/header.html :: head"></head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header">网站设置</div>
          <div class="layui-card-body" pad15>
            
            <div class="layui-form" wid100 lay-filter="">
              <div class="layui-form-item">
                <label class="layui-form-label">网站标题</label>
                <div class="layui-input-block">
                  <input type="text" name="settitle" th:value="${set[0].getSetTitle()}" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META关键词</label>
                <div class="layui-input-block">
                  <textarea name="setkeywords" class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割" th:text="${set[0].getSetKeywords()}"></textarea>
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META描述</label>
                <div class="layui-input-block">
                  <textarea name="setdescript" class="layui-textarea" th:text="${set[0].getSetDescription()}"></textarea>
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">站长邮箱</label>
                <div class="layui-input-block">
                  <input type="text" name="setemail" th:value="${set[0].getSetEmail()}" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">站长QQ</label>
                <div class="layui-input-block">
                  <input type="text" name="setqq" th:value="${set[0].getSetQq()}" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">APP二维码</label>
                <div class="layui-input-block">
                  <input type="text" name="setimage" th:value="${set[0].getSetImage()}" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">待定</label>
                <div class="layui-input-block">
                  <input type="text" name="setwait" th:value="${set[0].getSetWait()}" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">统计代码</label>
                <div class="layui-input-block">
                  <textarea name="settongji" class="layui-textarea" th:text="${set[0].getSetTongji()}"></textarea>
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
                  <textarea name="setbanquan" class="layui-textarea" th:text="${set[0].getSetBanquan()}"></textarea>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="set_website">确认保存</button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script th:src="@{/layuiadmin/layui/layui.js}"></script>
  <script>
    layui.config({
      base: '/layuiadmin/' //静态资源所在路径
    }).extend({
      index: 'lib/index' //主入口模块
    }).use(['index', 'set','layer'],function (){
      var $ = layui.$
              ,form = layui.form
              ,layer = layui.layer
      //提交
      form.on('submit(set_website)', function(obj){
        //获取表单参数
        var date = obj.field;
        var setkeywords = $('textarea[name="setkeywords"]').val();
        var setdescript = $('textarea[name="setdescript"]').val();
        var settongji = $('textarea[name="settongji"]').val();
        var setbanquan = $('textarea[name="setbanquan"]').val();
        //请求接口
        $.post('/admin/setupdate',{
          "settitle":date.settitle,
          "setqq":date.setqq,
          "setimage":date.setimage,
          "setemail":date.setemail,
          "setkeywords":setkeywords,
          "setdescript":setdescript,
          "setwait":date.setwait,
          "settongji":settongji,
          "setbanquan":setbanquan,
        },function (res){
          if (res.success){
            layer.msg('修改成功', {
              icon: 1
              ,time: 1000
            });
          }else {
            layer.msg('修改失败', {
              icon: 1
              ,time: 1000
            });
          }
        },'json');
        return false;
      });
    });
  </script>
</body>
</html>